"""
应用配置模块
"""
import os
from typing import Optional
from pydantic_settings import BaseSettings

class Settings(BaseSettings):
    """应用配置类"""
    
    # 应用基础配置
    app_name: str = "CareerSupreme"
    app_version: str = "1.0.0"
    debug: bool = True
    
    # 服务器配置
    host: str = "0.0.0.0"
    port: int = 9000
    
    # 数据库配置
    db_host: str = "localhost"
    db_port: int = 3306
    db_name: str = "CareerSupreme"
    db_user: str = "root"
    db_password: str = "root"
    
    # 数据库连接URL
    @property
    def database_url(self) -> str:
        return f"mysql+pymysql://{self.db_user}:{self.db_password}@{self.db_host}:{self.db_port}/{self.db_name}"
    
    # JWT配置（预留）
    secret_key: str = "your-secret-key-here-change-in-production"
    algorithm: str = "HS256"
    access_token_expire_minutes: int = 30
    
    # 文件上传配置
    max_file_size: int = 10 * 1024 * 1024  # 10MB
    upload_dir: str = "static/uploads"
    
    # AI模型配置（预留）
    llm_api_key: Optional[str] = None
    llm_api_url: Optional[str] = None
    
    class Config:
        env_file = ".env"
        case_sensitive = False

# 创建全局配置实例
settings = Settings()